//
// UShape.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

public class UShape {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public UShape(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(UShape obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_UShape(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public boolean getMeshTriangles(Vector_CVector vertices, Vector_uint16 indices) {
    return nel3dJNI.UShape_getMeshTriangles(swigCPtr, this, Vector_CVector.getCPtr(vertices), vertices, Vector_uint16.getCPtr(indices), indices);
  }

  public void getVisualCollisionMesh(UVisualCollisionMesh colMesh) {
    nel3dJNI.UShape_getVisualCollisionMesh(swigCPtr, this, UVisualCollisionMesh.getCPtr(colMesh), colMesh);
  }

  public long getNumMaterials() {
    return nel3dJNI.UShape_getNumMaterials(swigCPtr, this);
  }

  public UMaterial getMaterial(long materialId) {
    return new UMaterial(nel3dJNI.UShape_getMaterial(swigCPtr, this, materialId), true);
  }

  public boolean getDefaultOpacity() {
    return nel3dJNI.UShape_getDefaultOpacity(swigCPtr, this);
  }

  public boolean getDefaultTransparency() {
    return nel3dJNI.UShape_getDefaultTransparency(swigCPtr, this);
  }

  public UShape() {
    this(nel3dJNI.new_UShape__SWIG_0(), true);
  }

  public UShape(IShape object) {
    this(nel3dJNI.new_UShape__SWIG_1(IShape.getCPtr(object), object), true);
  }

  public void attach(IShape object) {
    nel3dJNI.UShape_attach(swigCPtr, this, IShape.getCPtr(object), object);
  }

  public void detach() {
    nel3dJNI.UShape_detach(swigCPtr, this);
  }

  public boolean empty() {
    return nel3dJNI.UShape_empty(swigCPtr, this);
  }

  public IShape getObjectPtr() {
    long cPtr = nel3dJNI.UShape_getObjectPtr(swigCPtr, this);
    return (cPtr == 0) ? null : new IShape(cPtr, false);
  }

}
